home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / initscripts.preinst < prev    next >
Encoding:
Text File  |  2007-04-10  |  1.3 KB  |  53 lines

  1. #! /bin/sh
  2. #
  3. # initscripts preinst
  4. #
  5.  
  6.  
  7. # Remove a no-longer used conffile
  8. #
  9. # $1: conffile
  10. #
  11. # If the argument was not listed as a conffile, silently do nothing.
  12. # Adapted from code obtained from www.dpkg.org/ConffileHandling
  13. eliminate_conffile() {
  14.     CONFFILE="$1"
  15.     if [ -f "$CONFFILE" ]; then
  16.         CURRENT_MD5SUM="$(md5sum "$CONFFILE" 2>/dev/null | sed -e "s/ .*//")"
  17.         FACTORY_MD5SUM="$(sed -n -e "/^Conffiles:/,/^[^ ]/{\\' $CONFFILE'{s/.* //;p}}" /var/lib/dpkg/status)"
  18.         if [ "$CURRENT_MD5SUM" != "$FACTORY_MD5SUM" ]; then
  19.             echo -n "Renaming obsolete modified conffile "
  20.             mv -vf "$CONFFILE" "$CONFFILE".dpkg-old
  21.         else
  22.             echo -n "Unmodified conffile '${CONFFILE}' obsolete; "
  23.             rm -vf "$CONFFILE"
  24.         fi
  25.     fi
  26. }
  27.  
  28. case "$1" in
  29.   install|upgrade)
  30.     #
  31.     # /etc/init.d/stop-bootlogd used to be a symlink to bootlogd;
  32.     # now it is a separate script.  We need to remove the symlink here,
  33.     # before dpkg installs the /etc/init.d/stop-bootlogd file.
  34.     #
  35.     [ -L /etc/init.d/stop-bootlogd ] && rm -f /etc/init.d/stop-bootlogd
  36.     #
  37.     # Remove obsolete conffiles
  38.     #
  39.     if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-10" ; then
  40.         eliminate_conffile "/etc/init.d/bootclean.sh"
  41.     fi
  42.     #
  43.     # Move conflicting log _file_ if present
  44.     #
  45.     [ -f /var/log/fsck ] && mv -f /var/log/fsck /var/log/fsck.dpkg-old
  46.     ;;
  47.   abort-upgrade)
  48.     exit 0
  49.     ;;
  50. esac
  51.  
  52. :
  53.